
<template xmlns:th="http://www.w3.org/1999/xhtml">



  <center>



    <div  >

      <!--  <div  style ="height: 1000px;width: 1000px;background-color: #42b983">-->


      <!-- 正文   补全信息  补全信息 补全信息补全信息补全信息补全信息补全信息-->

<!--      <img src="../../static/帅.jpg"  width="200px" height="100px">  <br>-->


      <el-form ref="form" :model="form" label-width="80px">

        <el-form-item label="mobile" >
          <el-input  v-model="form.mobile"></el-input>
        </el-form-item>


        <el-form-item label="公司名称">
          <el-input v-model="form.name"></el-input>
        </el-form-item>

        <el-form-item label="法人姓名">
          <el-input v-model="form.corporation"></el-input>
        </el-form-item>


        <el-form-item label="身份证号">
          <el-input v-model="form.certNum"></el-input>
        </el-form-item>

        <!--========================================================================-->

        <!--    身份证照片 *3-->

        <el-form-item label="身份证正面">
          <el-upload :on-success="handleAvatarSuccess" :show-file-list="false" class="avatar-uploader"  action="http://localhost:9999/house-resource/oss/upload">
            <img v-if="imageUrl" :src="imageUrl" class="avatar">
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
        </el-form-item>




        <el-form-item label="身份证反面">
          <el-upload :on-success="handleAvatarSuccess2" :show-file-list="false" class="avatar-uploader"  action="http://localhost:9999/house-resource/oss/upload">
            <img v-if="imageUrl2" :src="imageUrl2" class="avatar">
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
        </el-form-item>


        <el-form-item label="手持身份证">
          <el-upload :on-success="handleAvatarSuccess3" :show-file-list="false" class="avatar-uploader"  action="http://localhost:9999/house-resource/oss/upload">
            <img v-if="imageUrl3" :src="imageUrl3" class="avatar">
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
        </el-form-item>





        <!--    营业执照-->

        <el-form-item label="营业执照">
          <el-upload :on-success="handleAvatarSuccess4" :show-file-list="false" class="avatar-uploader"  action="http://localhost:9999/house-resource/oss/upload">
            <img v-if="imageUrl4" :src="imageUrl4" class="avatar">
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
        </el-form-item>



        <!--========================================================================-->
        <!--    办公地址-->

        <el-form-item label="城市地区">

          <el-cascader
            v-model="pcd"
            :options="regions"
            :props="regionsProps"
            @change="handleChange"
          />

        </el-form-item>



        <!--========================================================================-->
        <!--    输入详细地址-->


        <!--      <el-form-item label="输入详细地址">-->
        <!--        <el-input v-model="form.name"></el-input>-->
        <!--      </el-form-item>-->



        <el-form-item>
          <el-button type="primary" @click="add">提交</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>







    </div>
  </center>
</template>

<script>

export default {

  data() {
    return {

      form: {
        mobile:'18505268955'
      },
      imageUrl: '',
      imageUrl2: '',
      imageUrl3: '',
      imageUrl4: '',
      pcd: [],
      regions: [],
      regionsProps: {
        value: 'regionId',
        label: 'regionName',
        children: 'regions'
      },



    }

  },created() {

    this.initRegion()
  },

  methods: {

    onSubmit() {
      console.log('submit!');
    },
    add() {


      this.axios.post("http://localhost:9999/system-management/saveInformAtion", this.form
      ).then((response) => {
        this.$router.push({path: '/MoreMessage2'});

      })


    },
    upload() {

      alert("upload");

//
//       this.instance.post("http://localhost:9999/system-management/saveInformAtion/oss/upload",formData).then((res)=>{
// alert(res.data)
//
//

      // let self = this;
      // if (self.$refs.new_image.files.length !== 0) {
      //   var formData = new FormData()
      //   formData.append('image_data', self.$refs.new_image.files[0]);
      //
      //   //单个文件进行上传
      //   self.$ajax.post('http://localhost:9999/system-management/saveInformAtion/oss/upload', formData, {
      //     headers: {
      //       "Content-Type": "multipart/form-data"
      //     }
      //   }).then(response => {
      //     alert(res.data)
      //   })
      // }


    },//upload   end
    handleAvatarSuccess(res, file) {
      console.log("这是参数999999", res, file)
      this.imageUrl = URL.createObjectURL(file.raw);  //展示图片
      // if (res) {
      //   this.form.img = res   //记录上传的地址 让其一会保存到数据库，显示在前台
      // }

    }, handleAvatarSuccess2(res, file) {
      console.log("这是参数999999", res, file)
      this.imageUrl2 = URL.createObjectURL(file.raw);  //展示图片
      // if (res) {
      //   this.form.img = res   //记录上传的地址 让其一会保存到数据库，显示在前台
      // }

    }, handleAvatarSuccess3(res, file) {
      console.log("这是参数999999", res, file)
      this.imageUrl3 = URL.createObjectURL(file.raw);  //展示图片
      // if (res) {
      //   this.form.img = res   //记录上传的地址 让其一会保存到数据库，显示在前台
      // }

    }, handleAvatarSuccess4(res, file) {
      console.log("这是参数999999", res, file)
      this.imageUrl4 = URL.createObjectURL(file.raw);  //展示图片
      // if (res) {
      //   this.form.img = res   //记录上传的地址 让其一会保存到数据库，显示在前台
      // }

    },
    initRegion() {
      this.axios({
        method: 'post',
        url: 'http://localhost:9999/system-management/sysRegion/list',
        params: {
          parentId:1
        }
      }).then((res) => {
        if (res.data) {
          this.regions = res.data.obj
        }
      })

    },
    handleChange(value) {
      console.log(JSON.stringify(value) + '!!!!')
      /* var name=this.$refs["cascader"].getCheckedNodes()[0].pathLabels;//获取省市区名称
       console.log(name+"==============================")*/
      // 记录改变值
      this.pcd = value
      /*  this.addr = name[0]+name[1]+name[2]
        console.log(this.addr+"------------------------")*/
    },






  }
}

</script>
